package com.practice.demo.Component;

import com.practice.demo.Model.UserBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
public class UserComponent {
    public void hello2() {
        System.out.println("这是UserComponent");

    }

    @Bean({"u1","u2"})

    public UserBean userBean() {
        return new UserBean("zhangsan", 1);
    }

    @Bean
   // @Primary
    public UserBean userBean1() {
        return new UserBean("lisi", 2);
    }

}
